#include "stdafx.h"
#include "ClassList.h"
#include "InstanceTouch.h"
DECL_INSTANCE_TOUCH(ETouch_ClassList);

struct  ClassListDefReflectionRegister
{
	ClassListDefReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(ClassList,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(ClassList,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();
		
		GlobalClassManager::Instance().RegisterClass(ClassList::s_GetReflection(),eDefaultDef_ClassList);
		GlobalDefManager::Instance().RegisterDefManger(&ClassListManager::Instance());

	}
}___ClassListDefReflectionRegister;

rewrite  void ClassList::OnArchieveReaded()
{
}

void ClassListManager::OnArchieveReaded()
{
	__ClassListManager::OnArchieveReaded();
	Clear();
	std::vector<const CClass*> vClasses;
	GlobalClassManager::Instance().EnumerateClasses(vClasses);
	
	for(uint32 ii=0;ii<vClasses.size();ii++)
	{
		const CClass& rClass=*vClasses[ii];
		ClassList*pNewItem=new ClassList();
		pNewItem->m_iID=rClass.GetClassID();
		pNewItem->m_sDisplayName=rClass.GetLocalizedName();
		this->AddItem(pNewItem->m_iID,pNewItem);
	}
}